package com.dtstack.rocketmq.listener;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * GrainCostControoler
 *
 * <p>
 *     发布事件：在需要的地方发布事件
 * </p>
 *
 * @author chuanbai
 * @date 2024/11/11
 */
@RestController
public class GrainCostController {


    @Resource
    private GrainCostEventPublisher grainCostEventPublisher;

    public GrainCostController(GrainCostEventPublisher grainCostEventPublisher) {
        this.grainCostEventPublisher = grainCostEventPublisher;
    }

    @GetMapping("/event")
    public String postGrainCostEvent() {
        grainCostEventPublisher.postGrainCostEvent("Hello, XiaoAI!");
        return "Event posted";
    }
}
